<template>
<div class="enter">
  <input type="text" v-model="stu.stuno" placeholder="请输入学号">
  <input type="text" v-model="stu.name" placeholder="请输入姓名">

  <button @click="querystu">查询</button>

  <table>
    <tr>
      <td>学号</td>
      <td>班级</td>
      <td>姓名</td>
      <td>性别</td>
      <td>年龄</td>
    </tr>
    <tr v-for="(stu, key) in querystus" :key="key">
      <td>{{stu.stuno}}</td>
      <td>{{stu.class}}</td>
      <td>{{stu.name}}</td>
      <td>{{stu.gender}}</td>
      <td>{{stu.age}}</td>
    </tr>
  </table>
</div>
</template>

<script>
import {students} from "../store/student"
export default {

  name: "Student",
  data() {
    return {
      students,
      querystus: [],
      stu: {}
    }
  },
  methods: {
    querystu() {
      this.students.filter((v,index) => {
        if(v.stuno == this.stu.stuno && v.name == this.stu.name) {
          return v
        }
      }).map(v => this.querystus.push(v))
    }
}
}
</script>

<style scoped>
</style>